<!-- 我的钱包 -->
<template>
	<view class="content">
		<view class="glist" v-for="(item,index) in walletLog" :key="index" @click="getDetail(item)">
			<view class="gone">
				<text class="biao">{{item.title}}</text>
				<text class="biaotime">{{item.createtime}}</text>
			</view>
			<text class="nei">{{item.content}}</text>
		</view>
	</view>
</template>

<script>
	import { mapState, mapActions, mapGetters } from 'vuex';
	export default {
		components: {},
		data() {
			return {
				loadStatus: 'loadmore', //loadmore-加载前的状态，loading-加载中的状态，nomore-没有更多的状态
				currentPage: 1,
				lastPage: 1,
				walletLog:[],
				isEmpty: false,
			};
		},
		computed: {
		},
		onShow() {
		},
		onLoad(){
			this.getWalletLog()
		},
		// 触底加载更多
		onReachBottom() {
			if (this.currentPage < this.lastPage) {
				this.currentPage += 1;
				this.getWalletLog();
			}
		},
		methods: {
			getWalletLog() {
				let that = this;
				that.loadStatus = 'loading';
				that.$http('home.needgetList', {
					// wallet_type: 'money',
					// status: that.stateCurrent,
					// date: that.propsDate,
					page: that.currentPage
				}).then(res => {
					console.log(res)
					if (res.code === 1) {
						that.walletLog = [...that.walletLog, ...res.data.list];
						// that.incomeMoney = res.data.income;
						// that.expendMoney = Math.abs(res.data.expend);
						that.isEmpty = !that.walletLog.length;
						that.lastPage = res.data.lastpage;
						that.loadStatus = that.currentPage < res.data.lastpage ? 'loadmore' :
							'nomore';
						console.log(that.walletLog)	
					}
				});
			},
			getDetail(item){
				this.jump('/pages/user/new/GongDetail?id='+item.id)
			},
			jump(path, query) {
				this.$Router.push({
					path: path,
					query: query
				});
			},
		}
	};
</script>

<style lang="scss" scoped>
	// 钱包记录
	.content {
		.glist{
			padding: 20rpx;
			border-radius: 10rpx;
			// margin-bottom: 20rpx;
			background-color: #fff;
			margin: 20rpx 20rpx 0;
			.gone{
				display: flex;
				flex-direction: row;
				align-items: center;
				padding-bottom: 20rpx;
				border-bottom: 1rpx solid #eee;
				padding-top: 10rpx;
				.biao{
					color: #333;
					font-weight: 400;
					font-size: 28rpx;
				}
				.biaotime{
					margin-left: auto;
					color: #666;
					font-weight: 400;
					font-size: 24rpx;
				}
			}
			.nei{
				margin-top: 20rpx;
				color: #666;
				font-size: 26rpx;
				display: block;
			}
		}
	}
</style>
